package com.anche.cywebnew.Service.configManager.impl;

import com.anche.cywebnew.DAO.configManager.ServerClusterMapper;
import com.anche.cywebnew.Pojo.configManager.SysServerCluster;
import com.anche.cywebnew.Service.configManager.ServerClusterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.UUID;

@Service
public class ServerClusterServiceImpl implements ServerClusterService {

    @Autowired
    private ServerClusterMapper serverClusterMapper;

    @Override
    public List<SysServerCluster> getServerList() {
        return serverClusterMapper.selectList();
    }

    @Override
    public void addServerCluster(SysServerCluster cluster) {
        cluster.setId(UUID.randomUUID().toString().replaceAll("-", ""));
        serverClusterMapper.insertServerCluster(cluster);
    }

    @Override
    public void setServerCluster(SysServerCluster cluster) {
        serverClusterMapper.updateById(cluster);
    }

    @Override
    public void delServerCluster(String id) {
        serverClusterMapper.deleteById(id);
    }
}
